package chapter11;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2018-03-23 上午11:55
 */
public class ScannerTest {
    public static void main(String[] args) {
        boolean flag = true;
        try (Scanner scanner = new Scanner(System.in)) {
            scanner.useDelimiter("\n");
            while (flag) {
                System.out.println("please input data");
                String input = null;
                if (scanner.hasNext()) {
                    input = scanner.next();
                }
                if ("q".equals(input)) {
                    System.out.println("quit...");
                    flag = false;
                } else {
                    System.out.println("[input]:" + input);
                }
            }
        }
    }
}
